/**
 * @version 1.0
 * @author Ha Giang
 * @date
 */
package DiscoveryFunction;

public class ServiceInfo {

    private String uuid;
    private String type;  //ex:printer
    private String ip;
    public static String Delimitter = ":";
    //, Desc;
    private int port;
    private long expire = 0;//in milisec

    public ServiceInfo() {
    }

    /**
     * convert a service information to a string
     *
     * @return
     */
    @Override
    public String toString() {
        return (uuid + Delimitter + type + Delimitter + ip + Delimitter + port
                + Delimitter + expire);
    }

    /**
     * Load service information from a string
     *
     * @param s
     */
    public void loadString(String s) {
        String[] tem = s.split(Delimitter);
        uuid = tem[0];
        type = tem[1];
        ip = tem[2];
        port = new Integer(tem[3]);
        expire = new Long(tem[4]);
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public long getExpire() {
        return expire;
    }

    public void setExpire(long expire) {
        this.expire = expire;
    }
}